use crate::{config::AppContext, domain::setting::Setting, ApiResponse};
use axum::{response::IntoResponse, Form};

pub async fn save(mut setting: Form<Setting>) -> impl IntoResponse {
    if setting.webpass.as_ref().map_or(true, |f| f.is_empty()) {
        setting.webpass = None;
    }
    let _ = Setting::update_by_column_skip(AppContext::rbatis(), &setting, "id", true).await;
    ApiResponse::from("操作成功".to_string())
}
